package com.niiwoo.civet.trade.service.local.newRefund.notify.enums;

import com.niiwoo.activity.event.constant.BizEventRabbitConstant;
import com.niiwoo.asset.cardniu.dto.mq.CardNiuExternalMQConstants;
import com.niiwoo.asset.constant.MqConstants;
import com.niiwoo.asset.org.business.constants.OrgRabbitConstant;
import com.niiwoo.civet.trade.constant.MqConstant;
import com.niiwoo.civet.trade.constant.RabbitConstant;
import com.niiwoo.civet.trade.constant.TradeFanoutRabbitConstant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.NoSuchElementException;

/**
 * 还款相关通知
 * 
 * @author: kevin.jia
 * @version 1.0.0
 */
@Getter
@AllArgsConstructor
public enum RefundNotifyEnum {
	
	// R360相关通知
	R360_REFUND_RESULT(10, InvokeMode.INVOKEMODE_MQ, "融360-还款结果通知", false, MqConstants.Exchange.ASSET_EXCHANGE,
			MqConstants.getRoutingKey(MqConstants.Exchange.ASSET_EXCHANGE, MqConstants.Queue.REPAYMENT_RESULT)),
	R360_REFUND_PLAN_CHANGE(12, InvokeMode.INVOKEMODE_MQ, "融360-还款计划变更通知", false, MqConstants.Exchange.ASSET_EXCHANGE,
			MqConstants.getRoutingKey(MqConstants.Exchange.ASSET_EXCHANGE, MqConstants.Queue.REPAYMENT_PLAN_PUSH)),
	R360_PROJECT_STATUS_CHANGE(13, InvokeMode.INVOKEMODE_MQ, "融360-标的状态变更通知", false, MqConstants.Exchange.ASSET_EXCHANGE,
			MqConstants.getRoutingKey(MqConstants.Exchange.ASSET_EXCHANGE, MqConstants.Queue.ORDER_STATUS_NOFIFY_FOR_COMMON)),
	
	// 卡牛相关通知
	CARDNIU_REFUND_RESULT(20, InvokeMode.INVOKEMODE_DUBBO, "卡牛-还款结果通知", true, "refundDubboService", "notifyRepayResult"),
	CARDNIU_PROJECT_STATUS_CHANGE(21, InvokeMode.INVOKEMODE_MQ, "卡牛-标的状态变更通知", false, CardNiuExternalMQConstants.Exchange.LOAN_STATUS_EXCHANGE,
			CardNiuExternalMQConstants.getRoutingKey(CardNiuExternalMQConstants.Exchange.LOAN_STATUS_EXCHANGE, CardNiuExternalMQConstants.Queue.LOAN_STATUS_QUEUE)),
	
	// 神盾相关通知
	SHENDUN_REFUND_RESULT(30, InvokeMode.INVOKEMODE_MQ, "神盾-还款结果通知", false, RabbitConstant.Exchange.FOLLOW_WORK_TASK_REPAYMENT,
			RabbitConstant.RoutingKey.FOLLOW_WORK_TASK_REPAYMENT),
	SHENDUN_PROJECT_OVERDUE(31, InvokeMode.INVOKEMODE_MQ, "神盾-标的逾期通知", false, RabbitConstant.Exchange.FOLLOW_WORK_TASK_ADD,
			RabbitConstant.RoutingKey.FOLLOW_WORK_TASK_ADD),
	
	// 活动中心
	ACTIVITY_PRIZE_LOAN_RETURN_CASH(40, InvokeMode.INVOKEMODE_DUBBO, "活动中心-借款返现红包事件", true, "activityPrizeDubboService", "useLoancashBackPrize"),
	ACTIVITY_PRIZE_INVEST_RATE(41, InvokeMode.INVOKEMODE_DUBBO, "活动中心-投资加息红包事件", true, "activityPrizeDubboService", "useInterestRatePrize"),
	ACTIVITY_PRIZE_INTEREST_DISCOUNT(42, InvokeMode.INVOKEMODE_DUBBO, "活动中心-借款利率折扣事件", true, "activityPrizeDubboService", "useInterestDiscountPrize"),
	ACTIVITY_PRIZE_BACKED(43, InvokeMode.INVOKEMODE_DUBBO, "活动中心-设置红包返现完成事件", true, "activityPrizeDubboService", "setPrizeToBacked"),
	ACTIVITY_EXCHANGE_RETURN_CASH(44, InvokeMode.INVOKEMODE_DUBBO, "活动中心-借新还旧返现事件", true, "activityPrizeDubboService", "addRefinancingUserPrize"),
	
	ACTIVITY_RAISE_RATE(48, InvokeMode.INVOKEMODE_DUBBO, "活动中心-运营投资加息事件", true, "projectRaiseRateDubboService", "repayProjectRaiseRate"),
	
	ACTIVITY_EVENT_AVA_AMOUNT_CHANGE(45, InvokeMode.INVOKEMODE_MQ, "活动中心-帐户可用余额变更通知", false, BizEventRabbitConstant.Exchange.BIZ_EVENT_DIRECT_EXCHANGE,
			BizEventRabbitConstant.Key.BIZ_EVENT_CREDIT_CHANGE_USABLE_KEY),
	ACTIVITY_EVENT_PROJECT_STATUS_CHANGE(46, InvokeMode.INVOKEMODE_MQ, "活动中心-项目状态变更通知", false, BizEventRabbitConstant.Exchange.BIZ_EVENT_DIRECT_EXCHANGE,
			BizEventRabbitConstant.Key.BIZ_EVENT_PROJECT_STATUS_CHANGE_KEY),
	ACTIVITY_EVENT_PROJECT_OVERDUE(47, InvokeMode.INVOKEMODE_MQ, "活动中心-项目逾期变更通知", false, BizEventRabbitConstant.Exchange.BIZ_EVENT_DIRECT_EXCHANGE,
			BizEventRabbitConstant.Key.BIZ_EVENT_OVERDUE_PROJECT_KEY),	
	ACTIVITY_EVENT_INVEST_RETURN_AMOUNT(49, InvokeMode.INVOKEMODE_MQ, "活动中心-投资回款通知", false, TradeFanoutRabbitConstant.Exchange.INVEST_RETURN_AMOUNT_FANOUT_EXCHANGE,
			null),
	
	// 天称
	TIANCHENG_BORROWER_REFUND(50, InvokeMode.INVOKEMODE_DUBBO, "天称-借款人还款数据回流", true, "tianChengRefundEventService", "refundSucceed"),
	TIANCHENG_INVESTOR_RECEIVE(51, InvokeMode.INVOKEMODE_DUBBO, "天称-投资人回款数据回流", true, "tianchengDataFlowService", "investRefund"),
	TIANCHENG_PROJECT_STATUS(52, InvokeMode.INVOKEMODE_DUBBO, "天称-标的状态变更数据回流", true, "tianchengDataFlowService", "projectStatusChange"),
	TIANCHENG_PROJECT_OVERDUE(54, InvokeMode.INVOKEMODE_DUBBO, "天称-标的逾期数据回流", true, "tianChengRefundEventService", "projectOverdue"),
	
	// 用户
	USER_BLACK_LIST(60, InvokeMode.INVOKEMODE_MQ, "用户-黑灰名单数据维护", false, MqConstant.BLACK_LIST_STORAGE_EXCHANGE, MqConstant.BLACK_LIST_STORAGE_ROUTE),
	
	// 借款人消息
	MESSAGE_BORROWER_REFUND(70, InvokeMode.INVOKEMODE_DUBBO, "借款人-还款消息通知", true, "", ""),
	
	// 投资人消息
	MESSAGE_INVESTOR_RECEIVE(80, InvokeMode.INVOKEMODE_DUBBO, "投资人-回款消息通知", true, "", ""),
	
	// 机构（包括鸿特，暖心借）
	ORG_REFUND_RESULT(90, InvokeMode.INVOKEMODE_MQ, "机构-还款结果通知", false, OrgRabbitConstant.Exchange.ORG_COMMON_DIRECT_EXCHANGE,
			MqConstants.getRoutingKey(OrgRabbitConstant.Exchange.ORG_COMMON_DIRECT_EXCHANGE, OrgRabbitConstant.Queue.REPAYMENT_SUCCESS_NOTIFY_QUEUE)),
	ORG_REFUND_PLAN_CHANGE(91, InvokeMode.INVOKEMODE_MQ, "机构-还款计划变更通知", false, OrgRabbitConstant.Exchange.ORG_COMMON_DIRECT_EXCHANGE,
			MqConstants.getRoutingKey(OrgRabbitConstant.Exchange.ORG_COMMON_DIRECT_EXCHANGE, OrgRabbitConstant.Queue.REPAYMENT_PLAN_CHANGE_NOTIFY_QUEUE)),
	ORG_PROJECT_STATUS_CHANGE(92, InvokeMode.INVOKEMODE_MQ, "机构-标的状态变更通知", false, OrgRabbitConstant.Exchange.ORG_COMMON_DIRECT_EXCHANGE,
			MqConstants.getRoutingKey(OrgRabbitConstant.Exchange.ORG_COMMON_DIRECT_EXCHANGE, OrgRabbitConstant.Queue.PROJECT_STATUS_CHANGE_NOTIFY_QUEUE)),

	///汇介
//	Huijie_REFUND_PLAN_CHANGE(94, InvokeMode.INVOKEMODE_MQ, "汇介-还款计划变更通知", false, HuijieMqConstants.Exchange.ASSET_HUIJIE_EXCHANGE,
//							  HuijieMqConstants.getRoutingKey(HuijieMqConstants.Exchange.ASSET_HUIJIE_EXCHANGE, HuijieMqConstants.Queue.REPAYMENT_PLAN_PUSH)),
//	Huijie_PROJECT_STATUS_CHANGE(95, InvokeMode.INVOKEMODE_MQ, "汇介-标的状态变更通知", false, HuijieMqConstants.Exchange.ASSET_HUIJIE_EXCHANGE,
//								 HuijieMqConstants.getRoutingKey(HuijieMqConstants.Exchange.ASSET_HUIJIE_EXCHANGE, HuijieMqConstants.Queue.ORDER_STATUS_NOFIFY_QUEUE)),
//	Huijie_REFUND_RESULE(96, InvokeMode.INVOKEMODE_MQ, "汇介-还款结果通知", false, HuijieMqConstants.Exchange.ASSET_HUIJIE_EXCHANGE,
//			 HuijieMqConstants.getRoutingKey(HuijieMqConstants.Exchange.ASSET_HUIJIE_EXCHANGE, HuijieMqConstants.Queue.REFUND_NOTIFY_QUEUE))
	;
	private Integer type;
	
	private Integer invokeMode;
	
	private String desc;
	
	private Boolean compensate;
	
	// 对应消息的功能请求参数，针对不同的InvokeMode定义有区别
	private String param1;
	
	private String param2;
	
	public static RefundNotifyEnum enumOf(Integer type) {
		for (RefundNotifyEnum refundNotifyEnum : values()) {
			if (refundNotifyEnum.type.equals(type)) {
				return refundNotifyEnum;
			}
		}
		throw new NoSuchElementException("RefundNotifyEnum:" + type);
	}	
}